package com.ruoyi.system.service.impl;

import java.util.Date;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SchedulingMapper;
import com.ruoyi.system.domain.Scheduling;
import com.ruoyi.system.service.ISchedulingService;

import javax.annotation.Resource;

/**
 * 排班Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-02-26
 */
@Service
public class SchedulingServiceImpl implements ISchedulingService 
{
    @Resource
    private SchedulingMapper schedulingMapper;

    /**
     * 查询排班
     * 
     * @param id 排班主键
     * @return 排班
     */
    @Override
    public Scheduling selectSchedulingById(Long id)
    {
        return schedulingMapper.selectSchedulingById(id);
    }

    /**
     * 查询排班列表
     * 
     * @param scheduling 排班
     * @return 排班
     */
    @Override
    public List<Scheduling> selectSchedulingList(Scheduling scheduling)
    {
        return schedulingMapper.selectSchedulingList(scheduling);
    }

    /**
     * 新增排班
     * 
     * @param scheduling 排班
     * @return 结果
     */
    @Override
    public int insertScheduling(Scheduling scheduling)
    {
        scheduling.setCreateTime(DateUtils.getNowDate());
        return schedulingMapper.insertScheduling(scheduling);
    }

    /**
     * 修改排班
     * 
     * @param scheduling 排班
     * @return 结果
     */
    @Override
    public int updateScheduling(Scheduling scheduling)
    {
        scheduling.setUpdateTime(DateUtils.getNowDate());
        return schedulingMapper.updateScheduling(scheduling);
    }

    /**
     * 批量删除排班
     * 
     * @param ids 需要删除的排班主键
     * @return 结果
     */
    @Override
    public int deleteSchedulingByIds(Long[] ids)
    {
        return schedulingMapper.deleteSchedulingByIds(ids);
    }

    /**
     * 删除排班信息
     * 
     * @param id 排班主键
     * @return 结果
     */
    @Override
    public int deleteSchedulingById(Long id)
    {
        return schedulingMapper.deleteSchedulingById(id);
    }

    @Override
    public List<Scheduling> findScheduling(String dId, String date) {
        return schedulingMapper.findScheduling(dId,date);
    }
}
